//
//  RealmConfig.swift
//  Example
//
//  Created by admin on 2020/9/2.
//  Copyright © 2020 admin. All rights reserved.
//

import UIKit
//import Realm

extension UIApplication{
    public class func configRealm() {
        let dbVersion : UInt64 = 2
        let docPath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)[0] as String
        let dbPath = docPath.appending("/defaultDB.realm")
        
//        let config = Realm.Configuration(fileURL: URL.init(string: dbPath), inMemoryIdentifier: nil, syncConfiguration: nil, encryptionKey: nil, readOnly: false, schemaVersion: dbVersion, migrationBlock: { (migration, oldSchemaVersion) in
//
//        }, deleteRealmIfMigrationNeeded: false, shouldCompactOnLaunch: nil, objectTypes: nil)
        

//        Realm.Configuration.defaultConfiguration = config
//        Realm.asyncOpen { (realm, error) in
//            if let _ = realm {
//                print("Realm 服务器配置成功!")
//            }else if let error = error {
//                print("Realm 数据库配置失败：\(error.localizedDescription)")
//            }
//        }
    }
}
